import { create } from "zustand"
import { getUserInfo, setUserInfo } from "@/utils/app-util"
const userInfoStore = create((set, get) => ({
  userInfo: getUserInfo(),
  updateInfo: (newVal) => {
    set(() => ({ userInfo: newVal }))
    setUserInfo(newVal)
  },
  getToken: () => get().userInfo?.token
}))

export default userInfoStore
